package PenTest.Soluation13;

import java.util.*;


/**
 *  题目： 添加字符
 *  只要找出现有字符不相同的个数即可
 *
 *
 */

public class Main {

    public static void main(String[] args) {

        // 输入
        Scanner in = new Scanner(System.in);
        String A = in.next();
        String B = in.next();


        // 利用差值遍历
        int Alen = A.length();
        int Blen = B.length();

        int k = Blen - Alen;
        int maxlen = 0;
        while (k >= 0) {
            int count = 0;
            int cur = k;
            int dest = 0;
            while (cur < Blen && dest < Alen) {
                // 一旦相等就 count ++
                if (A.charAt(dest) == B.charAt(cur)) {
                    count++;
                } 

                // 两个字符串都要向后走
                dest++;
                cur ++;
            }

            // 更新相同的字符个数
            maxlen = Math.max(maxlen, count);
            k--;

        }

        // 输出
        System.out.println(Alen-maxlen);
    }
}